From: Ken Horton <ken.horton@ntlworld.com>
To: 'John Becker' <john.becker@wimborne.co.uk>
Subject: Canute Tide Predictor
Date: 10 November 2003 08:01

John

You possibly recall our correspondence at the beginning of the year (below)
on the Canute Tide Predictor and a problem with incorrect tide times.

The unit has been brought back from Portugal for me to look at. I have made
the following changes:

GETHRS: clrf STORE2
GTHRS2: incf STORE2,F    ;get hours value (divide by 60)
        movlw 60
        subwf STORE0,F
        btfsc STATUS,C
        goto GTHRS2
        movlw 1
        subwf STORE1,F
        btfsc STATUS,C
        goto GTHRS2
        decf STORE2,F
        movlw 60
        addwf STORE0,F
;        movlw 24
;        xorwf STORE2,W
;        btfsc STATUS,Z
;        clrf STORE2
;        return
        movlw 232       ; * Ken kfh
        addwf STORE2,w  ; * Ken kfh
        BTFSS STATUS,C  ; * Ken kfh
        return          ; * Ken kfh
        movwf STORE2    ; * Ken kfh
        return          ; * Ken kfh



GETSIN: movf INDF,W     ;BYTE2 ;is angle >= 90?
GS1:
        movwf STORE1
        addlw 166
        btfss STATUS,C
        goto GS2        ;no
        sublw 90        ;yes, now subtract answer from 90
;        movwf STORE1    ;and store new value
	goto GS1        ; * Ken kfh
GS2:    return

There is no evidence that GETSIN is going wrong, but I thought it was a wise
precaution!


I have also made the following change to the graph as it was 'sticking' at
one end when the duration of the low and high tides were significantly
different.

CHKHI:  movf CLKHRS,W     ;are HRS = high tide hours?
        xorwf NXTHI1,W
        btfss STATUS,Z
        goto CHKLO
        movf CLKMIN,W     ;are MINS = high tide mins?
        xorwf NXTHI0,W
        btfss STATUS,Z
        goto CHKLO
        clrf TIDEUP
        movlw 0xBC        ; * Ken kfh
        movwf TIDE0       ; * Ken kfh
        movlw 1           ; * Ken kfh
        movwf TIDE1       ; * Ken kfh
        call CLRLN1       ; * Ken kfh
        goto GF0

CHKLO:  movf CLKHRS,W     ;are HRS = low tide hours?
        xorwf NXTLO1,W
        btfss STATUS,Z
        goto GF3          ;no
        movf CLKMIN,W     ;yes, are MINS = low tide mins?
        xorwf NXTLO0,W
        btfss STATUS,Z
        goto GF3          ;no
        bsf TIDEUP,0      ;yes
        clrf TIDE0        ; * Ken kfh
        clrf TIDE1        ; * Ken kfh
        call CLRLN1       ; * Ken kfh
        movlw 15
        call LCDPX1
        movlw '>'
        call LCDOUT
        movlw 12           ;show time of next high tide
        call LCDPX2
        movf NXTHI1,W
        movwf NOWHI1
        call LCDHEX
        movf NXTHI0,W
        movwf NOWHI0
        call LCDHEX
        goto GF3


Regards


Ken





Hi Ken,

Funny thing is that I know Canute is in successful use as readers have
told
me (one in Portugal keeps ON telling me :-)  But I fully accept that
your
unit has this problem.

I'll have a look at the code again when I get the opportunity. Perhaps
24.00
might be the clue.

Regards,

John


----- Original Message -----
From: <ken.horton@willowbank.fsnet.co.uk>
To: John Becker <john.becker@wimborne.co.uk>; John Becker
<john.becker@wimborne.co.uk>
Sent: Tuesday, February 04, 2003 11:18 PM
Subject: Re: Canute Tide Predictor


> John
>
> I don't know exactly when it went wrong as the boat is not attended all
the time. It
> was some time between mid December and last week. The clock and calendar
were
> still running, but obviously with the high tide value of 25:19, it never
matched.
>
> It is something that happens very rarely, so it must be some combination
of very
> rare circumstances. Could it be that in intermediate calculation of the
tide ends up
> exactly as 24:00 and is not reset to 00:00?
>
> Regards
>
> Ken
>
>
> On 3 Feb 2003 at 13:57,  John Becker wrote:
>
> Hi Ken
>
> How very odd - I'll look into it sometime but cant offer a speedy fix
> as I no longer have the design and will have to try "pure analysis"
> exam of the software.  What calendar information prevailed at that
> particular instant?
>
> Regards,
>
> John
>
> ----- Original Message -----
> From: <ken.horton@willowbank.fsnet.co.uk>
> To: John Becker <john.becker@wimborne.co.uk>; John Becker
> <john.becker@wimborne.co.uk>
> Sent: Sunday, February 02, 2003 1:08 PM
> Subject: Re: Canute Tide Predictor
>
>
> > John
> >
> > I now have a little more information.
> >
> > Canute has been running for about 4 months, set to tide time in
> > Southern
> Portugal.
> >
> > Display shows:
> >
> > 1851 1550 2519
> >
> > with the time continuing to run. Obviously, in this state, it never
> matches the high
> > tide time and thus is effectively frozen.
> >
> > Regards
> >
> > Ken
> >
> >
> > On 30 Oct 2002 at 10:51,  John Becker wrote:
> >
> > Hi Kenneth,
> >
> > No I'm not aware of this problem and no-one else has reported it. I
> > regret though that you have not given me enough info for me to look
> > into this occasional error - let me know if you do determine the
> > circumstances.
> >
> > Regards, John
> >
> >
> > ----- Original Message -----
> > From: Fay Kenward <fay.kenward@wimborne.co.uk>
> > To: John Becker <john.becker@wimborne.co.uk>
> > Sent: Monday, October 28, 2002 9:34 AM
> > Subject: FW: Canute Tide Predictor
> >
> >
> > >
> > >
> > > -----Original Message-----
> > > From: ken@willowbank.fsnet.co.uk
> > > [mailto:ken@willowbank.fsnet.co.uk] Sent: 28 October 2002 07:39
> > > To: john.becker@epemag.wimborne.co.uk Subject: Canute Tide
> > > Predictor
> > >
> > >
> > > Dear Mr Becker
> > >
> > > When the article for the Canute Tide Predictor was published, I
> > > built one, and this is in continual use on an ocean going boat in
> > > Portugal.
> > >
> > > I understand that every so often, the clock goes wrong displaying
> > > 25:00 hours before locking-up. Unfortunately, I am unable to give
> > > you the precise details of the error as I have not had chance to
> > > witness the symptoms first hand.
> > >
> > > Are you aware of this error, and if so if there a fix for it?
> > >
> > >
> > > Regards
> > >
> > > Kenneth Horton 